<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<style type="text/css">
.dateWidth1{
   width:195px;
}
.selectWidth2{
   width:205px;
}
</style>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<div class="t_bar"><span class="color_red">*</span>物联网产品或服务销售发票清单</div>
<table  id="tblInvoices" cellpadding="0" class="table01" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead >
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="5%">选择</th>
						<th class="TblHead" align="center"  width="5%">序号</th>
						<th class="TblHead" align="center"  width="15%">产品或服务名称</th> 
				        <th class="TblHead" align="center"  width="15%">金额（万元）</th> 
						<th class="TblHead" align="center"  width="15%">发票号码</th> 
						<th class="TblHead" align="center"  width="15%">开票日期</th> 
						<th class="TblHead" align="center"  width="15%">买方名称</th> 
						<th class="TblHead" align="center"  width="15%">备注</th> 
					</tr>
			</thead>
			<tbody id="tab">
					<tr style="display:none">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selInvoices" >
						</td>
						<td align="center">&nbsp;
							<span name="invoices|invoice[0]@seq_no" >[index]</span> 
						</td>
						<td>
							<input type="text" name="invoices|invoice[0]|name"  class=" input_text required" maxlength="50" style="width:80%" label="产品或服务名称"/>
						</td>
						<td>
							<input type="text" name="invoices|invoice[0]|money"  label="金额" onchange="ledningVal();" onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right;width:80%" class=" input_text required" />
						</td> 
						<td>
							<input type="text" name="invoices|invoice[0]|number"  class=" input_text required" maxlength="50" style="width:80%" label="发票号码"/>
						</td>
						<td>
							<input id="invoice_date[0]" name="invoices|invoice[0]|invoice_date" value="" style="width:80px" class="input_text required date  color_gray" readOnly label="开票日期" />
						</td> 
						<td>
							<input type="text" name="invoices|invoice[0]|buyer_name" label="买方名称" maxlength="50" style="width:80%" class="input_text required"/>
						</td> 
						<td>
							<input type="text" name="invoices|invoice[0]|remark" label="备注" maxlength="50" style="width:80%" class="input_text required"/>
						</td> 
						
					</tr>
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/invoices/invoice" var="invoice">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr >
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selInvoices" >
						</td>
						<td align="center">&nbsp;
							<span name="invoices/invoice[${flag}${index}]@seq_no" ><x:out select="$invoice/@seq_no"/></span> 
						</td>
						<td>
							<input type="text" name="invoices/invoice[${flag}${index}]/name"   style="width:80%"   class=" input_text required" value="<x:out select="$invoice/name"/>" label="产品或服务名称" maxlength="50"/>
						</td>
						<td >
							<input type="text" name="invoices/invoice[${flag}${index}]/money" onchange="ledningVal();" onfocus="InitInput.setNumber(this,7,4,2)" label="金额"  style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$invoice/money" />"/>
						</td> 
						<td>
							<input type="text" name="invoices/invoice[${flag}${index}]/number"   style="width:80%"   class=" input_text required" value="<x:out select="$invoice/number"/>" label="发票号码" maxlength="50"/>
						</td>
						<td >
							<input id="invoice_date${flag}${index}" name="invoices/invoice[${flag}${index}]/invoice_date" value="<x:out select='$invoice/invoice_date' />" class="input_text required date color_gray" readOnly label="开票日期" style="width:80px"/>
						</td> 
						<td>
							<input type="text" name="invoices/invoice[${flag}${index}]/buyer_name"   style="width:80%"   class=" input_text required" value="<x:out select="$invoice/buyer_name"/>" label="买方名称" maxlength="50"/>
						</td>
						<td>
							<input type="text" name="invoices/invoice[${flag}${index}]/remark"   style="width:80%"   class=" input_text required" value="<x:out select="$invoice/remark"/>" label="备注" maxlength="50"/>
						</td>
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
					<script type="text/javascript">
						showAllDateTag('tblInvoices');
					</script>
				</tbody>
					</table>
					<table   cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;" id="dkqk1">
					<tr >
					<td colspan="3" width="25%" align="center">合计</td>
					<td width="15%" ><input name="invoices/invoice_total" id="invoice_total" value="<x:out select="$xmlData/data/invoices/invoice_total" />" disabled class=" input_text gray" label="金额合计" style="text-align:right;width:80%" /></td>
					<td width="15%" align="center">\</td>
					<td width="15%" align="center">\</td>
					<td width="15%" align="center">\</td>
					<td width="15%" align="center">\</td>
					</tr>
                   </table>
					<table width="98%" align="center">
					<tr ><td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="addNewRow('tblInvoices');showAllDateTag('tblInvoices');try{top.resizeFrame();}catch(e){};ledningVal();">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblInvoices','selInvoices')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblInvoices','selInvoices')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblInvoices','物联网产品或服务销售发票清单情况');ledningVal();">
					</td></tr>
	</table>
	
	<script type="text/javascript">
	function ledningVal(){
	 var invoice_total=0;
	 $("#tblInvoices").find("input[name$='money']").each(function() {
		 if ($.isNumeric($(this).val())) {
			 invoice_total = parseFloat(invoice_total) + parseFloat($(this).val());
		 }
	 });
	 invoice_total = ((parseFloat(invoice_total)*10000)/10000).toFixed(4);
	 $("#invoice_total").val(formatNumberAutoOther(invoice_total+"", 7, 4, 2));
	}
	</script>
	
	

